<template>
	<view id="invite">
		<Header txt="邀请好友" v-if="baidu"></Header>
		<HeaderB txt="邀请好友" v-if="!baidu"></HeaderB>
		<view class="invite">
			<view class="content">
				<text>
					{{input}}
					
				</text>
				<button type="" @click.native="copy">复制</button>
				<!-- <input type="text" v-model="input" placeholder="" > -->
				
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				input:"",
				new:"",
				baidu:true
			}
		},
		computed: {
		    userInfo(){
		      return this.$store.state.userInfo
		    }
		},
		onShow(){
			// #ifdef MP-BAIDU
			this.baidu=false
			// #endif
		},
		onLoad() {
			this.input = 'http://www.xiongmaodaili.com?invitationCode=' + this.userInfo.invitationCode;
		},
		methods: {
			copy(){
				uni.setClipboardData({
				  data:this.input,//要被复制的内容
				  success:()=>{//复制成功的回调函数
				    uni.showToast({//提示
				      title:"复制成功"
				    })
				  }
				});
			}
		}
	}
</script>

<style lang="less" scoped>
	#invite{
		overflow: hidden;
	}
	.invite{
		padding-top: 1400rpx;		
		background: url(https://iconimg.oss-cn-hangzhou.aliyuncs.com/%E7%86%8A%E7%8C%AB%E4%BB%A3%E7%90%86/invite_bg.png) no-repeat center center;
		background-size: cover;
		height: 100%;
	}
	.content{
		height: 300rpx;
		position: absolute;
		top:55%;
		left: 20%;
		right: 20%;
		button{
			width: 30%;
			font-size: 28rpx;
			margin-top: 40rpx;
			position: relative;
			background: #007AFF;
			color: #FFFFFF;
			top: -10rpx;
		}
	}
</style>
